public class Test {
    public static void arr(int[] array) {
        int tmp = 0;

        for (int i = 0; i < array.length; i++) {
            for (int j = i+1; j < array.length; j++) {
                if (array[i] > array[j]) {
                   tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                }
            }
        }
        int temp = array[array.length / 2];
        int num = 0;
        for (int i = 0; i < array.length; i++) {
            if (array[i] == temp) {
                num++;
            }
        }
        if (num > array.length / 2) {
            System.out.println(temp);
        }
    }

    public static void main(String[] args) {
        int[] array=new int[]{4,44,4,4};
        arr(array);
    }
}